package net.oschina.victor.liu.lemon.service;

import java.util.List;
import java.util.Set;

import org.springframework.data.domain.Page;

import net.oschina.victor.liu.lemon.common.MessageException;
import net.oschina.victor.liu.lemon.entity.Role;
import net.oschina.victor.liu.lemon.entity.User;

public interface UserService {

	public Boolean save(User user, String[] roleIds) throws MessageException;

	public Boolean update(User user, String[] roleIds) throws MessageException;

	public Boolean delete(Long id) throws MessageException;

	public Page<User> list(String keyword, Integer pageNo, Integer pageSize);

	/**
	 * 通过用户ID查询用户
	 * 
	 * @param id
	 * @return
	 */
	public User getUser(Long id);

	/**
	 * 通过用户名查询用户
	 * 
	 * @param username
	 * @return
	 */
	public User getUser(String username);

	/**
	 * 通过用户名称查询用户所对应的角色
	 * 
	 * @param username
	 * @return
	 */
	public Set<String> findRoles(String username);

	/**
	 * 通过用户名称查询用户对应的权限信息
	 * 
	 * @param username
	 * @return
	 */
	public Set<String> findPermissions(String username);
}
